package data;
import java.util.Date;

public class Sighting implements Comparable{
	private String location ; 
	private Date dateTime ;

	public Sighting(String location, Date dateTime) {
		super();
		this.location = location;
		this.dateTime = dateTime;
	}
	public String getLocation() {
		return location;
	}
	public void setLocation(String location) {
		this.location = location;
	}
	public Date getDateTime() {
		return dateTime;
	}
	public void setDateTime(Date dateTime) {
		this.dateTime = dateTime;

	}
	@Override
	public int compareTo(Object o) {
		// TODO Auto-generated method stub

		if(!(o instanceof Sighting))
			throw new ClassCastException("Invalid Object");

		Sighting otherSighting = (Sighting)o;

		if(this.getDateTime().after(otherSighting.getDateTime()))
			return 1 ; 

		else if (otherSighting.getDateTime().after(this.getDateTime()))
			return -1 ; 

		else return 0 ; 

	} 


}
